package com.itheima;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class FileSearch {
    public static List<String> SearchFiles(String catalogue,String DocumentName)
    {
        List<String> list = new ArrayList<String>();
        File dir = new File(catalogue);
        File[] files = dir.listFiles();
        if(files != null)
        {
            for(File file : files)
            {
                if(file.isDirectory()&&file.getName()==DocumentName)
                {
                    list.add(file.getName());
                }
                else if(file.getName().contains(DocumentName))
                {
                    list.add(file.getAbsolutePath());
                }
            }
        }
        return list;
    }
}